<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 150px;
            height: 150px;
            border: 1px solid black;
            margin: 20px;
        }

        .default {

        }

        .orange {
            background: orange;
        }

        .skyblue {
            background: skyblue;
        }
    </style>
</head>

<body>
    <div id="app">
        <h3>组件</h3>
        <!-- 1. 在子组件标签上自定义属性 -->
        <!-- 2. 在子组件中通过props来接受 -->
        <!-- <com title="买好123导购网" num="100"/> -->
        <btn type="skyblue" />
    </div>

    <!-- <template id="com">
        <div class="box">
            {{ title }} --- {{ num }}
        </div>
    </template> -->

    <template id="btn">
        <button :class="type">我是按钮</button>
    </template>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>

        Vue.component('btn', {
            template: "#btn",
            props: ['type']
        })



        // Vue.component('com', {
        //     template: "#com",
        //     // 接受父组件传递过来的值
        //     props: ["title", "num"]
        // })



        const app = new Vue({
            el: "#app",
            data: {}
        })
    </script>
</body>

</html>